package org.bozo.im.activity.roster;

import java.util.ArrayList;

import org.bozo.im.common.types.Presence;
import org.bozo.im.common.types.RawContact;

public class ContactAggregator {

	private long mContactId;
	private String mDisplayName;
	private Presence mPresence;
	private ArrayList<RawContact> mContacts;

	public void addContact(RawContact pContact) {
		if (mContacts == null) {
			mDisplayName = pContact.getDisplayName();
			mPresence = pContact.getPresence();
			mContactId = pContact.getContactId();
			mContacts = new ArrayList<RawContact>();

		} else if (pContact.getPresence().getPriority() < mPresence.getPriority()) {
			mPresence = pContact.getPresence();
		}

		if (pContact.getPresence() != Presence.OFFLINE)
			mContacts.add(pContact);
	}

	public String getDisplayName() {
		return mDisplayName;
	}

	public Presence getPresence() {
		return mPresence;
	}

	public long getSystemId() {
		return mContactId;
	}

	public ArrayList<RawContact> getContacts() {
		return mContacts;
	}
}
